CarExtender

Helper class to add Android Auto extensions to notifications. To create a notification with car extensions:

  1. Create an NotificationCompat.Builder, setting any desired properties.
  2. Create a CarExtender.
  3. Set car-specific properties using the add and set methods of CarExtender.
  4. Call extend to apply the extensions to a notification.
  5. Post the notification to the notification system with the NotificationManagerCompat.notify(...) methods and not the NotificationManager.notify(...) methods.
Notification notification = new NotificationCompat.Builder(context)
        ...
        .extend(new CarExtender()
                .set*(...))
        .build();

Car extensions can be accessed on an existing notification by using the CarExtender(Notification) constructor, and then using the get methods to access values.

Constructors

Link copied to clipboard
constructor()
Create a CarExtender with default options.
constructor(@NonNull notification: Notification)
Create a CarExtender from the CarExtender options of an existing Notification.

Types

Link copied to clipboard
A class which holds the unread messages from a conversation.

Functions

Link copied to clipboard
Apply car extensions to a notification that is being built.
Link copied to clipboard
open fun getColor(): Int
Gets the accent color.
Link copied to clipboard
Gets the large icon used in this car notification, or null if no icon has been set.
Link copied to clipboard
Returns the unread conversation conveyed by this notification.
Link copied to clipboard
Sets the accent color to use when Android Auto presents the notification.
Link copied to clipboard
Sets the large icon of the car notification.
Link copied to clipboard
Sets the unread conversation in a message notification.